package de.freudenreichdesign.webshop.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import de.freudenreichdesign.webshop.model.Article;
import de.freudenreichdesign.webshop.service.ArticleService;

@Controller
@RequestMapping("/productDetails.html")
public class ProductDetailController{

	@RequestMapping(method=RequestMethod.GET)
	protected String handleRequest(@RequestParam("articleID") long articleID, ModelMap modelMap) {
		Article article = ArticleService.getInstance().getArticleByID(articleID);
		modelMap.addAttribute(article);
		return "productDetailView";
	}

}
